#ifndef __SPACEDEFENDER_View_H__
#define __SPACEDEFENDER_View_H__

#include <Ogre.h>

namespace spacedefender
{

class Model;
class GameConsole;

class View : public Ogre::FrameListener
{
	public:
		View(Model* model);
		virtual ~View();
		virtual bool Initialize();
		virtual bool Update();
		virtual Ogre::RenderWindow* GetWindow() const;
		virtual void AddFrameListener(Ogre::FrameListener* listener);
		virtual void Yaw(Ogre::Radian angle);
		virtual void Roll(Ogre::Radian angle);
		virtual void Pitch(Ogre::Radian angle);
		virtual void UpdateStats();
		
		// FrameListener overrides 
		virtual bool frameStarted(const Ogre::FrameEvent& evt); 
		virtual bool frameEnded(const Ogre::FrameEvent& evt);
		virtual GameConsole* GetConsole() const;
	private:
		virtual bool InitOgreCore();

		virtual void CreateSceneManager();
		virtual void CreateCamera();
		virtual void CreateViewports();
		virtual void CreateResourceListener();
		
		virtual void AddResourceLocations();
		virtual void InitResources();

		virtual void CreateScene();
		virtual void DestroyScene();
		
		
		
		Ogre::Root *_root;
		Ogre::Camera* _camera;
		Ogre::SceneNode* _rollNode;
		Ogre::SceneNode* _pitchNode;
		Ogre::SceneNode* _yawNode;
		Ogre::SceneNode* _cameraNode;
		Ogre::SceneManager* _sceneMgr;
		Ogre::RenderWindow* _window;
		Ogre::SceneNode* _robotNode;
		Ogre::Overlay* _debugOverlay;
		
		Model* _model;
		GameConsole* _gameConsole;
};

}
#endif // __SPACEDEFENDER_View_H__
